<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
session_save_path(realpath('../tmp/sessions/'));
session_start(); 
function random($len){ 
	$srcstr = "0123456789"; 
	mt_srand();
	$strs=""; 
	for($i=0;$i <$len;$i++){ 
		$strs.=$srcstr[mt_rand(0,(strlen($srcstr)-1))]; 
	} 
	return strtoupper($strs); 
}
$str = random(4); 
$width = 45; 
$height = 20; 
header("Content-Type:image/gif"); 
$im = imagecreate($width,$height); 
$back = imagecolorallocate($im,0xFF,0xFF,0xFF); 
$pix = imagecolorallocate($im,187,230,247); 
$font = imagecolorallocate($im,41,163,238); 
mt_srand(); 
for($i=0;$i <1000;$i++){ 
	imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$pix); 
} 
imagestring($im,5,4,2,$str,$font); 
imagerectangle($im,0,0,$width-1,$height-1,$font); 
imagepng($im); 
imagedestroy($im); 
$_SESSION['SafeCode'] = $str;
unset($str,$strs,$font,$pix,$im,$back,$len);
?>